const {
	default: userStore
} = require("./userStore");
const {
	default: pidStore
} = require("./pidStore");

export default {
	onShow() {
		let pages = getCurrentPages();
		if (pages.length >= 1) {
			this.$x.pageRouter = (pages[pages.length - 1]).route
			this.$x.pageOption = (pages[pages.length - 1]).options
			if (this.$x.pageOption.pid) {
				pidStore.set(this.$x.pageOption.pid);
			}
			console.log('option', this.$x.pageOption)
			console.log('route', this.$x.pageRouter)
			if (this.$x.pageRouter) {
				this.$x.mpShare = {
					title: '', // 分享标题
					path: this.$x.pageRouter + '?pid=' + userStore.get().id, // 默认为当前页面路径
					imageUrl: '' // 默认为当前页面的截图
				}
			}
			return;
		}
	},
	// 分享到好友
	onShareAppMessage(el) {
		return this.$x.mpShare
	},
	// 分享到朋友圈
	onShareTimeline() {
		return this.$x.mpShare
	}
}